﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Nova_BLL
{
    public class Menu
    {
        int i = 0;
        DataSet ds = null;
        Nova_DAL.Menu Nova_DAL_Menu = new Nova_DAL.Menu();
        int strMenuID = 0;

        ///<summary>
        ///获取菜单列表
        ///</summary>
        ///<param name="sQL">SQL</param>
        ///<returns>返回DataSet</returnss>
        ///Writer：[王成友]
        ///Create Date： [2010-5-21]
        ///</summary>
        public DataSet DataListMenu()
        {
            try
            {

                ds = Nova_DAL_Menu.DataListMenu();
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            return ds;
        }


        ///<summary>
        ///获取菜单id
        ///</summary>
        ///<param name="菜单名称">菜单名称</param>
        ///<returns>返回菜单id</returnss>
        ///Writer：[王成友]
        ///Create Date： [2010-6-3]
        ///</summary>
        public int BackMenu(string vText)
        {
            try
            {
                strMenuID = Nova_DAL_Menu.BackMenu(vText);
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            return strMenuID;
        }

        ///<summary>
        ///获取菜单详细
        ///</summary>
        ///<param name="sQL">SQL</param>
        ///<returns>返回DataSet</returnss>
        ///Writer：[夏鑫]
        ///Create Date： [2010-5-27]
        ///</summary>
        public DataSet DataListMenu(int ID)
        {
            try
            {
                ds = Nova_DAL_Menu.DataListMenu(ID);
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            return ds;
        }

        ///<summary>
        ///获取指定菜单详细
        ///</summary>
        ///<param name="sQL">SQL</param>
        ///<returns>返回DataSet</returnss>
        ///Writer：[夏鑫]
        ///Create Date： [2010-6-4]
        ///</summary>
        public DataSet DataListMenu(string strvPemit)
        {
            try
            {
                ds = Nova_DAL_Menu.DataListMenu(strvPemit);
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            return ds;
        }

        ///<summary>
        ///增加菜单列表
        ///</summary>
        ///<param name="sQL">Menu</param>
        ///<returns>返回i</returnss>
        ///Writer：[王成友]
        ///Create Date： [2010-5-21]
        ///</summary>
        public int AddMenu(Nova_MOD.Menu Menu)
        {
            try
            {
                i = Nova_DAL_Menu.AddMenu(Menu);
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            return i;
        }

        ///<summary>
        ///显示用户对应的大类权限ID
        ///</summary>
        ///<param name="sQL">SQL</param>
        ///<returns>返回用户编号所对应的权限id</returnss>
        ///Writer：[王成友]
        ///Create Date： [2010-5-21]
        ///</summary>
        public DataSet UserRole(string vGroupNo)
        {
            ds = Nova_DAL_Menu.UserRole(vGroupNo);
            return ds;
        }

        ///<summary>
        ///显示用户对应的小类权限ID
        ///</summary>
        ///<param name="sQL">SQL</param>
        ///<returns>返回用户编号所对应的小类权限id</returnss>
        ///Writer：[王成友]
        ///Create Date： [2010-5-21]
        ///</summary>
        public DataSet UserRole(string vGroupNo, string iNode)
        {
            ds = Nova_DAL_Menu.UserRole(vGroupNo, iNode);
            return ds;

        }

        ///<summary>
        ///修改菜单列表
        ///</summary>
        ///<param name="sQL">Menu</param>
        ///<returns>返回i</returnss>
        ///Writer：[王成友]
        ///Create Date： [2010-5-21]
        ///</summary>
        public int UpdateMenu(Nova_MOD.Menu Menu)
        {
            try
            {
                i = Nova_DAL_Menu.UpdateMenu(Menu);
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            return i;
        }

        ///<summary>
        ///删除菜单列表
        ///</summary>
        ///<param name="sQL">id</param>
        ///<returns>返回i</returnss>
        ///Writer：[王成友]
        ///Create Date： [2010-5-21]
        ///</summary>
        public int DeleteMenu(string id)
        {
            try
            {
                i = Nova_DAL_Menu.DeleteMenu(id);
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            return i;
        }

        /// <summary>
        /// 删除多个菜单
        /// </summary>
        /// <param name="strID">菜单id</param>
        /// <returns>返回int,0失败,1成功</returns>
        ///Writer：[夏鑫]
        ///Create Date： [2010-5-28]
        public int DeleteAllMenu(string strID)
        {
            try
            {
                i = Nova_DAL_Menu.DeleteAllMenu(strID);
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            return i;
        }

    }
}
